package cn.com.infcn.monitor.util;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;

public class IFCWebUtils {

	public static long getCurrentThreadCpuTime(){
		ThreadMXBean THREAD_BEAN = ManagementFactory.getThreadMXBean();
		boolean CPU_TIME_ENABLED = THREAD_BEAN.isThreadCpuTimeSupported()
				&& THREAD_BEAN.isThreadCpuTimeEnabled();
		if (CPU_TIME_ENABLED) {
			return THREAD_BEAN.getThreadCpuTime(Thread.currentThread().getId());
		}
		return 0;
	}
	
	public static void main(String[] args) {
		long a = getCurrentThreadCpuTime();
		System.out.println(a);
	}
}
